package com.yj.audio_output_device_new.util.ble;

import android.app.Activity;
import android.content.Context;


import com.yj.audio_output_device_new.util.log.Log;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class BleUtil {
    private static final String TAG = BleUtil.class.getSimpleName();
    private static Ble ble;
    private static final List<HashMap<String, Object>> emptyList = new ArrayList<>();


    public static void init(WeakReference<Context> mContext){
        ble = new Ble(mContext);
    }

    public static List<HashMap<String, Object>> getA2dpConnectedDevices(){
        if(checkInvalid()){
            return emptyList;
        }
        return ble.getA2dpConnectedDevices();
    }

    public static void close(){
        if(checkInvalid()){
            return;
        }
        ble.close();
    }

    private static boolean checkInvalid(){
        if(ble == null){
            Log.e(TAG, "ble is null");
            return true;
        }
        return false;
    }
}
